package com.iursp.mapper.resource;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.iursp.domain.model.role.RoleResource;

import tk.mybatis.mapper.common.BaseMapper;

@Mapper
public interface RoleResourceMapper extends BaseMapper<RoleResource>{
	
	String columnSql = " refid,role_refid,resource_refid, active, deleted,create_user_refid,create_date_time,modify_user_refid,modify_date_time,version ";

	@Select("<script>SELECT "+columnSql+" FROM auth_role_resource WHERE 1=1 "
			+"<if test=\"roleRefid != null and roleRefid != ''\">"
			+ " AND role_refid = #{roleRefid} "
			+ "</if></script>")
	List<RoleResource> queryRoleResourceNodesByRoleRefid(RoleResource item);

	@Delete("DELETE FROM auth_role_resource WHERE role_refid = #{roleRefid}")
	Integer deleteRoleResource(@Param("roleRefid")String roleRefid);

}
